# @FileName  :  question.py
# @Time      :  2025/8/19
# @Author    :  靳一涛
# @info      :  讨论区相关的Pydantic模型
"""
    所有响应模型以Response结尾
    所有添加模型以Create结尾
    所有更新模型以Update结尾
"""
from pydantic import BaseModel
from typing import Optional,List
from fastapi import UploadFile,File,Form
# 管理员端











# 教师端










# 学生端

class UserResponse(BaseModel):
    id: int
    name: Optional[str] = None
    class Config:
        from_attributes = True
class QuesstionResponse(BaseModel):
    """
    问题模型
    """
    id: int
    content: Optional[str] = None
    send_time: Optional[str] = None
    extral_1: Optional[str] = None
    extral_2: Optional[str] = None
    extral_3: Optional[str] = None
    user_id: UserResponse
    class Config:
        from_attributes = True

class QuestionCreate(BaseModel):
    """
    问题模型
    """
    content: Optional[str] = None
    send_time: Optional[str] = None
    extral_2: Optional[str] = None
    user_id_id: int
class LoginResponse(BaseModel):
    id: int
    role: Optional[str] = None
    class Config:
        from_attributes = True

class UserResponse1(BaseModel):
    id: int
    login_id: LoginResponse
    name: Optional[str] = None
    class Config:
        from_attributes = True
class NumResponse(BaseModel):
    id: int
    user_id: UserResponse1
    class Config:
        from_attributes = True


# 图片上传
class ImgCreate(BaseModel):
    """
    图片上传模型
    """
    content: UploadFile = File(...)
    send_time: str = Form(...)
    extral_2: str = Form(...)
    user_id_id: int = Form(...)
    class Config:
        from_attributes = True
